#include <chrono>
#include <iostream>
#include <thread>
void pause_thread(int n) {
  std::cout << "Sleep " << n << " s\n";
  std::this_thread::sleep_for(std::chrono::seconds(n));
  std::cout << "Exit....\n";
}
int main() {
  std::thread t1 = std::thread(pause_thread, 2);
  std::thread t2 = std::thread(pause_thread, 2);
  std::cout << std::boolalpha;
  std::cout << "t1 is joinable:" << t1.joinable() << "\n";
  std::cout << "t2 is joinable:" << t2.joinable() << "\n";
  t1.join();
  t2.detach();
  std::cout << "t1 is joinable:" << t1.joinable() << "\n";
  std::cout << "t2 is joinable:" << t2.joinable() << "\n";
  return 0;
}
